<!doctype html>
<html>
<meta charset="utf-8"/>
<title>花集通 - 花集网</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="fav.ico" rel="shortcut icon"/>
<link rel="stylesheet" href="<?php echo JD_PUBLIC_URL; ?>/css/common.css" />
<link rel="stylesheet" href="<?php echo JD_PUBLIC_URL; ?>/css/ui_custom.css" />
<link rel="stylesheet" href="http://www.huaji.com//skin/web/css/main.css" />
<link rel="stylesheet" href="http://www.huaji.com//skin/web/css/member.css" />
<script type="text/javascript" src="<?php echo JD_PUBLIC_URL; ?>/js/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo JD_PUBLIC_URL; ?>/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="<?php echo JD_PUBLIC_URL; ?>/js/jquery.bgiframe.min.js"></script>
<script type="text/javascript" src="<?php echo JD_PUBLIC_URL; ?>/js/tdist.js"></script>
<script type="text/javascript" src="<?php echo JD_PUBLIC_URL; ?>/js/common.js"></script>
<script type="text/javascript" src="<?php echo JD_PUBLIC_URL; ?>/js/ajax.js"></script>
<script type="text/javascript" src="<?php echo JD_PUBLIC_URL; ?>/js/floatnav.js"></script>
</head>
<body>
<div class="container" id="page">
  <div class="navigation">
    <div class="crumbs"> <a href="http://www.huaji.com/index.php/app/job" >我的应用</a><span>&gt;</span><a href="<?php echo JD_BASE_URL;?>/main/">花集通</a><span>&gt;</span>京东 </div>
  </div>
  <div id="mainmenu" class="flow-steps num4 clearfix">
    <ol>
      <li class="done"><span class="first">1、选择平台</span></li>
      <li class="done current-prev"><span>2、获取数据</span></li>
      <li class="current"><span>3、选择派单</span></li>
      <li class="last"><span>4、完成</span></li>
    </ol>
  </div>
  <div class="condition">
    <div class="form">
      <form name="f1" id="f1" method="post"  ENCTYPE="multipart/form-data" action="<?php echo JD_BASE_URL;?>/paidang/done">   
        <input type="hidden" name="tid" id="tid" value="<?php echo $data[0]->order_id;?>" />  
        <div id="main">
        
         <div class="msgbox clearfix">
			  <div class="main_1 left">
				<div class="title">买家备注<span class="description">该部分内容会添加到花集订单的附件信息里，接单方可见。</span></div>
				<div class="row clearfix">
				  <div class="value">
					<div id="J_MsgContent">
					  <p><?php echo $data[0]->order_remark;?></p>
					  <p class="editbox"><a id="J_MsgEdit" href="#">修改</a></p>
					</div>
					<div id="J_MsgEditBox" style="display:none;">
                       
					  <textarea class="intro" rows="7" cols="82" name="buyer_message" ><?php echo $data[0]->order_remark;?></textarea>
                      
					  <button type="button" id="J_MsgOK" class="ico-submit">确定</button>
					  <button type="button" id="J_MsgCancel" class="ico-cancel">取消</button>
					</div>
				  </div>
				</div>
			  </div>
			  <div class="main_1 right">
				<div class="title">备忘信息</div>
				<div class="row clearfix">
				  <div class="value">
                  	<div id="J_MemoContent" class="memo-info">
						<p><span class="memo-flag meno_<?php echo $data[0]->id_remark;?>"></span><span id="memo-text"><?php echo $data[0]->vender_remark;?></span></p>
					  	<p class="editbox"><a id="J_MemoEdit" href="#">修改</a></p>
					</div>
					<div id="J_MemoEditBox" style="display:none;">
                     <div class="memo-info">
                     <?
                    for($i=0;$i<6;$i++)
					{
						echo ' <label><input type="radio" id ="id_remark" name="id_remark" value="'.$i.'"'.($data[0]->id_remark==$i?'checked':'').'/><span class="memo-flag meno_'.$i.'"></span></label>';	
					}
					?>                       
                    </div>
					  <textarea class="intro" rows="7" cols="82" id="vender_remark" name="vender_remark" ><?php echo $data[0]->vender_remark;?></textarea>
					  <button type="button" id="J_MemoOK" class="ico-submit">确定</button>
					  <button type="button" id="J_MemoCancel" class="ico-cancel">取消</button>
					</div>
					
				  </div>
				</div>
			  </div>
		  </div>
        
          <div id="main_0" class="main_1">
            <div class="row clearfix">
              <label class="label"> <span class="col">*</span>接单花店： </label>
             
              <div class="value"> 
                  
                   <?php if (in_array($_SESSION['jd_store_id'],array('1199804224','1288123456'))){ ?>
                    <span id="flowershop">杭州萱萱花艺</span>
                    <input type="hidden" id="floristName" name="floristName" value="杭州萱萱花艺"/>
                    <input type="hidden" id="floristId" name="floristId" value="1199792126"/>
                    <input type="hidden" id="floristAdd" name="floristAdd" value="凤起路花鸟市场">
                  <?php }else{ ?>
                    <span id="flowershop"><?php echo $seller[0]['floristname'];?></span>
                    <input type="hidden" id="floristName" name="floristName" value="<?php echo $seller[0]['floristname'];?>"/>
                    <input type="hidden" id="floristId" name="floristId" value="<?php echo $seller[0]['uniqueid'];?>"/>
                    <input type="hidden" id="floristAdd" name="floristAdd" value="<?php echo $seller[0]['address'];?>">
                 <?php } ?>
                 
                &nbsp;&nbsp;<a id="changeShop" href="#">修改</a></div>
            </div>
            <div class="row clearfix" style="">
              <label class="label"> <span class="col">*</span>配送时间： </label>
              <div class="value">
				<input type="text" id="datepicker" name="distribution_time" value="<?=date('Y-m-d')?>">
				
				<span id="hourbox" style="display:none">&nbsp;
                <select name="startHour">
				  <option value="00">00</option>
				  <option value="01">01</option>
				  <option value="02">02</option>
				  <option value="03">03</option>
				  <option value="04">04</option>
				  <option value="05">05</option>
				  <option value="06">06</option>
				  <option value="07">07</option>
				  <option value="08">08</option>
				  <option value="09">09</option>
				  <option value="10">10</option>
				  <option value="11">11</option>
				  <option value="12">12</option>
				  <option value="13">13</option>
				  <option value="14">14</option>
				  <option value="15">15</option>
				  <option value="16">16</option>
				  <option value="17">17</option>
				  <option value="18">18</option>
				  <option value="19">19</option>
				  <option value="20">20</option>
				  <option value="21">21</option>
				  <option value="22">22</option>
				  <option value="23">23</option>
			    </select>
                :
                <select name="startMinute">
                  <option value="00">00</option>
                  <option value="05">05</option>
                  <option value="10">10</option>
                  <option value="15">15</option>
                  <option value="20">20</option>
                  <option value="25">25</option>
                  <option value="30">30</option>
                  <option value="35">35</option>
                  <option value="40">40</option>
                  <option value="45">45</option>
                  <option value="50">50</option>
                  <option value="55">55</option>
                </select>
                </span>
                <span id="halfday">
				  <select id="datePart" name="time">
					<option value="0">全天</option>
					<option value="1">上午</option>
					<option value="2">下午</option>
					<option value="3">晚上</option>
                  </select>
				</span>
				<label for="timing">&nbsp;<input type="checkbox" id="timing" name="type" value="1" /> 定时</label>
              </div>
            </div>
            <div class="row clearfix">
              <label class="label">订单原价： </label>
              <div class="value"> 
            
                <span class="price"><?php echo $data[0]->order_payment ;?></span> 元
        
                <input name="price" type="hidden" id="price" onBlur="this.value=this.value.replace(/[^\d\.]/g,'')"  onKeyUp="this.value=this.value.replace(/[^\d\.]/g,'')" value="<?php echo $data[0]->order_payment ;?>" readonly>
              </div>
            </div>
            
            <div class="main_1" id="repeat_it">
              <div class="title"><span class="col">*</span>商品信息<span id="spots" class="spots">
                <input type="button" id="add"  class="btn" value="+添加一个商品信息"/>
                </span></div>
                <!------repeat_it------------->
             
              <?php foreach($data_info as  $k => $d){ ?>     
              <div class="gooditem">
                <table>
                  <tr>
                    <td><div style="width:200px;padding-left:15px;padding-top:10px;">
                        <div id="preview_<?php echo $k;?>"> <img id="imghead_<?php echo $k;?>" width=160 height=160 border=0 src='<?php echo str_replace ('/n5/','/n2/',$d->sku_image); ?>'> </div>
                        <div class="up_fileBox">
                          <input type="hidden" name="merch_no[]" value="<?php echo $d->sku_id; ?>">
                          <input type="hidden" id="flower_pic_<?php echo $k;?>" name="merch_pic[]" value="<?php echo str_replace ('/n5/','/n2/',$d->sku_image); ?>"/>
                          <!--<a href="javascript:void(0);" class="btn-upload"><em>浏览...</em><q>
                          <input style="margin-left:-132px;" type="file" des="<?php echo $k;?>" onChange="previewImage(this)" name="flowerpic[]" class="file"/>
                          </q></a>-->
						</div>
                      </div></td>
                    <td><div class="row clearfix">
                        <label class="label">商品名称：</label>
                        <div class="value">
                          <input type="text" class="input-text"  name="merch_name[]"  value="<?php echo $d->sku_name; ?>">
                        </div>
                      </div>
                      <div class="row clearfix">
                        <label class="label">商品单价：</label>
                        <div class="value">
                          <span class="price"><?php echo $d->jd_price; ?></span> 元                          
                        </div>
                      </div>
                      <div class="row clearfix">
                        <label class="label">配送单价：</label>
                        <div class="value">
                          <input type="text" class="input-text" name="merch_price[]"  value="0.00" onBlur="this.value=this.value.replace(/[^\d\.]/g,'')"  onKeyUp="this.value=this.value.replace(/[^\d\.]/g,'')">
                        </div>    
                      </div>
                      <div class="row clearfix">
                        <label class="label">商品数量：</label>
                        <div class="value">
                          <input type="text" class="input-text" name="merch_count[]"  value="<?php echo $d->item_total; ?>" onBlur="this.value=this.value.replace(/[^\d\.]/g,'')"  onKeyUp="this.value=this.value.replace(/[^\d\.]/g,'')">
                        </div>
                      </div>
                      <div class="row clearfix">
                        <label class="label">商品描述：</label>
                        <div class="value">
                          <textarea name="merch_intro[]" cols="70" rows="5" ></textarea>
                        </div>
                      </div></td>
                  </tr>
                </table>
                 <div class="btns">
                	 <input type="button" value="删除" class="btn-basic remove" style="margin-left:10px;">
                 </div>
              </div>
                                  
            <?php } ?>
             <!------repeat_it end-----goods-------------->
            </div>
           
            <input type="hidden" id="order_num" value="1" />
            <div class="main_1">
              <div class="title">收货信息</div>
              <div class="row clearfix">
                <label for="" class="label"><span class="col">*</span>收货人姓名：</label>
                <div class="value">
                  <input type="text" name="consignee" id="consignee" class="text_3" value="<?php echo $data[0]->fullname;?>">
                </div>
              </div>
              <div class="row clearfix">
                <label for="" class="label"> <span class="col">*</span>收货人地址：</label>
                <div class="value">
                <select id="receiver_state" name="province"></select>
                <select id="receiver_city" name="region"></select>
                <select id="receiver_district" name="town"></select>
                <script src="<?php echo JD_PUBLIC_URL; ?>/js/addcity.js"></script>
                <script>
                       addcity.run('<?php if(isset($province)) echo $province;?>', '<?php if(isset($city)) echo $city;?>', '<?php if(isset($town)) echo $town;?>');
                </script>
                <input type="text" name="address" id="address" class="text_3" value="<?php echo $data[0]->full_address;?>">
                </div>
              </div>
              <div class="row clearfix">
                <label for="" class="label"> 收货人电话：</label>
                <div class="value">
                  <input type="text" name="tel" class="text_3" value="<?php echo $data[0]->telephone;?>">
                </div>
              </div>
              <div class="row clearfix">
                <label for="" class="label"> 收货人手机：</label>
                <div class="value">
                  <input type="text" id="phone" name="phone" class="text_3" value="<?php echo $data[0]->mobile;?>">
                </div>
              </div>
            </div>
          
          
            <div class="main_1">
              <div class="title">贺卡信息</div>
              <div class="row clearfix">
                <label for="" class="label"> 贺卡类型：</label>
                <div class="value">
                  <select id="card" name="card">
                    <option value="0">不使用</option>
                    <option value="1">生日卡</option>
                    <option value="2">情人卡</option>
                    <option value="3">祝福卡</option>
                    <option value="4">A4纸</option>
                    <option value="5">其他</option>
                  </select>
                </div>
              </div>
              <div class="row clearfix">
                <label for="" class="label"> 贺卡内容 ：</label>
                <div class="value">
                  <textarea class="intro" rows="5" cols="82" name="card_intro"></textarea>
                </div>
              </div>
            </div>
            <div class="main_1">
              <div class="title">订货人信息</div>
              <div class="row clearfix">
                <div class="column">
                  <label for="" class="label"> 订货人姓名:</label>
                  <div class="value">
                    <input type="text" name="orderer_name" class="text_4" value="<?php echo $_SESSION['jd_user_name'];?>">
                  </div>
                </div>
                <div class="column">
                  <label for="" class="label"> 商家编号:</label>
                  <div class="value">
                    <input type="text" name="wangwang" class="text_4" value="<?php echo $data[0]->jd_uid;?>">
                  </div>
                </div>
              </div>
              <div class="row clearfix">
                <div class="column">
                  <label for="" class="label"> 联系方式:</label>
                  <div class="value">
                    <input type="text" name="orderer_tel" class="text_4" value="">
                  </div>
                </div>
                <div class="column">
                  <label for="" class="label"> 附加号码:</label>
                  <div class="value">
                    <input type="text" name="additional_number" class="text_4" value='<?php echo $data[0]->order_id;?>'>
                  </div>
                </div>
              </div>
             </div>
            <div class="buttons">
              <input id="submitForm" type="button" class="btn" value="下订单">
            </div>
          </div>
        </div>
      </form>
    </div>
  </div>
  <script type="text/javascript">
			function jumpto(p)
			{
				var shopPage=document.getElementById("shopPage");	
				shopPage.value=p;
				//alert(shopPage.value);
				Ajaxpost("<?php echo JD_BASE_URL;?>/paidang/findshop","shoplist1","shopSearch");
			}
			
			function sendto(pname,pvalue)
			{
				var shopPage=document.getElementById(pname);	
				shopPage.value=pvalue;
				//alert(shopPage.value);
				Ajaxpost("<?php echo JD_BASE_URL;?>/paidang/findshop","shoplist1","shopSearch");
				//处理tab
				
				if(pname=='tabindex')
				{
					//var tab=document.getElementById('tab'+pvalue);
					//alert(document.getElementById('tab').childNodes.item(length).parentNode);
					var oItem = document.getElementById('tab').getElementsByTagName("li"); 
					for(var i=0;i<3;i++)
					{
						if(i==pvalue)
							oItem[i].className="active";
						else
							oItem[i].className="";
									
					}
					
				}
				
				shopPage.value=0;
			}

</script>
  <div id="shopList">
      <div class="form">
   
      <div id="shopSearch" class="clearfix searchform"> 
        <input type="hidden" id="service" value="0" name="service">
       <input type="hidden" id="shopPage" value="1" name="shopPage">             
        <label for="province">所在地：</label>
            <select id="province" name="province" class="province">
            </select>
            <select id="region" name="region" class="region">
            </select>
             <select id="town" name="town" class="town">
            </select>        
			 <label for="keyword">关键字：</label>
	         <input type="text" name="keyword" id="keyword" class="input-base" style="width:100px;"> 
            <label for="J_SearchUserName">会员名：</label>
			  <input type="text" id="J_SearchUserName" name="username" value="" class="input-base" style="width:100px;" >
              <input type="button" value="搜索" id="searchShopList" class="basicBtn blueBtn">
      </div>
      
    </div>
    
   
      <div class="main-wrap">		 
		  <div class="tabs-container">
		   <div id="SearchStore" class="tab-pane active">			  
				<div class="store-list clearfix" id="shoplist1">
				  
		

			 </div>

	    </div>
        
  </div>
    </div>

  </div>
</div>
<script type="text/javascript"> 
$(document).ready(function(){ 
    
	var spotMax = 20;
	if($('div.spot').size() >= spotMax) {$(obj).hide();}
	$("input#add").click(function(){
		addSpot(this, spotMax);
	});
	
	mylp.province_city.run1('<?php if(isset($province)) echo $province;?>', '<?php if(isset($city)) echo $city;?>', '<?php if(isset($town)) echo $town;?>');
	
	
	$('#shopList').dialog({'title':'选择花店','autoOpen':false,'bgiframe':true,'position':'center','width':800,'height':550});
		$("#J_TabProvince").click(function(){
			$(this).parent().parent().find("li").removeClass("checked");
			$(this).parent().addClass("checked");
			$(".loc3").hide();
			$(".loc4").show();
			return false;
		});
		$("#J_TabCity").click(function(){
			$(this).parent().parent().find("li").removeClass("checked");
			$(this).parent().addClass("checked");
			$(".loc3").show();
			$(".loc4").hide();
			return false;
		});

	
	$("#changeShop").bind('click',function(){
		$("#shopList").dialog("option", { width: 850 , height: 600 }); // 设置参数
		$("#shopList").dialog("open");
		$.ajax({   
		   type:"post",   
		   data: "province=" + $("#province").val()+"&region="+$("#region").val()+"&town="+$("#town").val()+"&r ="+ Math.random(), 
		   url:"<?php echo JD_BASE_URL;?>/paidang/findshop/",   
		   success: function(data){
			  $("#shoplist1").html(data);
	     }});
		return false;
	});
	
	$("#searchShopList").bind('click',function(){
		//location='huajiShopList.php';
			//alert("查找");//
			Ajaxpost("<?php echo JD_BASE_URL;?>/paidang/findshop","shoplist1","shopSearch");
			
	});
	
	$("#timing").bind("click",function(){
		$('#hourbox').toggle();
		$('#halfday').toggle();
	});
	
	$('#J_MsgEdit,#J_MsgCancel').click(function(){
		$('#J_MsgContent').toggle();
		$('#J_MsgEditBox').toggle();
		$('#J_MsgEditBox textarea').val($('#J_MsgContent p:eq(0)').text());
	});
	$('#J_MsgOK').click(function(){
		//alert('Ajax保存留言信息，成功后，执行下面的动作');
		 
		//Ajax保存留言信息，成功后，执行下面的动作
		$('#J_MsgContent p:eq(0)').text($('#J_MsgEditBox textarea').val());
		$('#J_MsgContent').toggle();
		$('#J_MsgEditBox').toggle();
	});
	
	$('#J_MemoEdit,#J_MemoCancel').click(function(){
		$('#J_MemoContent').toggle();
		$('#J_MemoEditBox').toggle();
		$('#J_MemoEditBox textarea').val($('#memo-text').text());
	});
	$('#J_MemoOK').click(function(){
		//alert('Ajax保存留言信息，成功后，执行下面的动作');
		var num = $('#J_MemoEditBox input:checked').val();
		$.ajax({   
		   type:"post",   
		   data: "tid=" + $("#tid").val() + "&id_remark="+num+"&vender_remark="+$("#vender_remark").val()+"&r ="+ Math.random(), 
		   url:"<?php echo JD_BASE_URL;?>/paidang/smark",   
		   success: function(data){
			 if(data == 0)
			 {
			      alert('操作成功');
			 }
	     }});
		//Ajax保存留言信息，成功后，执行下面的动作
	  	
		$('#J_MemoContent .memo-flag').attr('class','memo-flag meno_'+num);
		$('#memo-text').text($('#J_MemoEditBox textarea').val());
		$('#J_MemoContent').toggle();
		$('#J_MemoEditBox').toggle();
	});
	
	
	//美化table奇偶行
	$('table.table-list tbody').each(function(idx){
		if (idx%2 == 1)
		{
			$(this).addClass('even');
		}
	});

	$( "#datepicker" ).datepicker({
		minDate:new Date(),
		defaultDate: +1,
		numberOfMonths: 2,
		showButtonPanel: true,
		dateFormat:"yy-mm-dd"
	});

        //删除商品
        $('#repeat_it').find("input.remove").click(function(){
	    $(this).parent().parent().hide("slow",function(){$(this).remove();});
	 });
	$.datepicker.regional['zh-CN'] = {
		closeText: '关闭',
		prevText: '&#x3c;上月',
		nextText: '下月&#x3e;',
		currentText: '今天',
		monthNames: ['一月','二月','三月','四月','五月','六月',
			'七月','八月','九月','十月','十一月','十二月'],
		monthNamesShort: ['一','二','三','四','五','六',
			'七','八','九','十','十一','十二'],
		dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
		dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
		dayNamesMin: ['日','一','二','三','四','五','六'],
		weekHeader: '周',
		dateFormat: 'yy-mm-dd',
		firstDay: 1,
		isRTL: false,
		showMonthAfterYear: true,
		yearSuffix: '年'
	};
	$.datepicker.setDefaults($.datepicker.regional['zh-CN']);



$('#submitForm').click(function(){		
		
		var o=document.getElementById('datepicker').value;
		var len=o.length;
		if(len!=10)
		{
			alert("日期格式不对");
			o.focus();
			return true;
		}
		
		var o=document.getElementsByName('merch_price[]');
		for(i=0;i<o.length;i++)
		{	
			/*if(isNaN(parseInt(o[i].value)))
				payment+=0;
			else
				payment+=parseInt(o[i].value);*/
			if(isNaN(o[i].value)||o[i].value.length<1)
			{
				if(confirm("配送价格没有填，要填写么？"))
				{
				o[i].focus();
				return true;
				}
			}
                        if(isNaN(o[i].value)||o[i].value<1)
			{
				alert("请正确填写配送价格");
				o[i].focus();
				return true;	
			}
		}
		

		var o=document.getElementById('consignee').value;
		var len=o.length;
		if(len==0)
		{
			alert("收货人姓名为必填项");
			o.focus();
			return true;
		}
		
		var o=document.getElementById('address').value;
		var len=o.length;
		if(len<3)
		{
			alert("收货人地址必须正确");
			o.focus();
			return true;
		}
		
		var o=document.getElementById('floristId').value;
		var len=o.length;
		if(len<3)
		{
			alert("接单花店没有选取，请选择接单花店");
			o.focus();
			return true;
		}
		
		var o=document.getElementById('phone').value;
		var len=o.length;
		if(len<3)
		{
			alert("收货人手机为必填项");
			o.focus();
			return true;
		}
		
		$('#f1').submit();
	});



});


</script>
</body>
</html>